# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=suricata-verify
pkgver=suricata.7.0.13.r21.g87fe8ad
pkgrel=1
epoch=1
pkgdesc='Suricata Verification Tests - Testing Suricata Output.'
groups=('blackarch' 'blackarch-misc' 'blackarch-ids')
arch=('any')
url='https://github.com/OISF/suricata-verify'
license=('custom:unknown')
depends=('python' 'python-yaml' 'python-future' 'jq')
makedepends=('git')
source=('git+https://github.com/OISF/suricata-verify.git')
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  ( set -o pipefail
    git describe --long --tags --abbrev=7 2>/dev/null |
      sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
    printf "%s.%s" "$(git rev-list --count HEAD)" \
      "$(git rev-parse --short=7 HEAD)"
  )
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md

  rm README.md

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python run.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

